/**
 * Copyright (C) 2010
 * Swarm Intelligence Team (SIT)
 * Department of Computer and Systems
 * University of Pernambuco
 * Brazil
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package br.upe.ecomp.dosa.view.mainwindow;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JSpinner;
import javax.swing.WindowConstants;

import org.jdesktop.layout.GroupLayout;

/**
 * 
 * @author Rodrigo Castro
 */
public abstract class ConfigureSimulation extends javax.swing.JDialog {

    private static final long serialVersionUID = 1L;

    /**
     * Creates new form ConfigureSimulation.
     */
    public ConfigureSimulation(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        defaultPanel = new JPanel();
        configurationPanel = new JPanel();
        numberSimulationsLabel = new JLabel();
        numberSimulationsSpinner = new JSpinner();
        cancelButton = new JButton();
        startButton = new JButton();
        realtimeSimulationCheckBox = new JCheckBox();
        progressPanel = new JPanel();
        progressBar = new JProgressBar();
        progressLabel = new JLabel();

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Configure Simulation");
        setMinimumSize(new Dimension(330, 150));
        setModal(true);
        setResizable(false);

        defaultPanel.setLayout(new CardLayout());

        configurationPanel.setLayout(null);

        numberSimulationsLabel.setText("Number of simulations:");
        numberSimulationsLabel.setToolTipText("Number of simulations");
        configurationPanel.add(numberSimulationsLabel);
        numberSimulationsLabel.setBounds(40, 20, 149, 16);
        configurationPanel.add(numberSimulationsSpinner);
        numberSimulationsSpinner.setBounds(200, 10, 79, 30);

        cancelButton.setText("Cancel");
        cancelButton.setToolTipText("Cancel");
        cancelButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });
        configurationPanel.add(cancelButton);
        cancelButton.setBounds(200, 90, 97, 29);

        startButton.setText("Start");
        startButton.setToolTipText("Start");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                startButtonActionPerformed(evt);
            }
        });
        configurationPanel.add(startButton);
        startButton.setBounds(100, 90, 97, 29);

        realtimeSimulationCheckBox.setText("Show realtime simulation");
        realtimeSimulationCheckBox.setToolTipText("Show realtime simulation");

        configurationPanel.add(realtimeSimulationCheckBox);
        realtimeSimulationCheckBox.setBounds(30, 50, 240, 23);

        defaultPanel.add(configurationPanel, "card2");

        progressLabel.setText("Simulating...");

        GroupLayout progressPanelLayout = new GroupLayout(progressPanel);
        progressPanel.setLayout(progressPanelLayout);
        progressPanelLayout.setHorizontalGroup(progressPanelLayout.createParallelGroup(GroupLayout.LEADING).add(
                progressPanelLayout
                        .createSequentialGroup()
                        .add(progressPanelLayout
                                .createParallelGroup(GroupLayout.LEADING)
                                .add(progressPanelLayout.createSequentialGroup().add(118, 118, 118).add(progressLabel))
                                .add(progressPanelLayout.createSequentialGroup().addContainerGap()
                                        .add(progressBar, GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)))
                        .addContainerGap()));
        progressPanelLayout.setVerticalGroup(progressPanelLayout.createParallelGroup(GroupLayout.LEADING).add(
                progressPanelLayout
                        .createSequentialGroup()
                        .add(22, 22, 22)
                        .add(progressLabel)
                        .add(18, 18, 18)
                        .add(progressBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE).addContainerGap(52, Short.MAX_VALUE)));

        defaultPanel.add(progressPanel, "card3");

        getContentPane().add(defaultPanel, BorderLayout.CENTER);

        getAccessibleContext().setAccessibleDescription("Configure Simulation");

        pack();
    }// </editor-fold>

    protected abstract void startButtonActionPerformed(ActionEvent evt);

    protected abstract void cancelButtonActionPerformed(ActionEvent evt);

    // Variables declaration - do not modify
    protected JButton cancelButton;
    protected JPanel configurationPanel;
    protected JPanel defaultPanel;
    protected JLabel numberSimulationsLabel;
    protected JSpinner numberSimulationsSpinner;
    protected JProgressBar progressBar;
    protected JLabel progressLabel;
    protected JPanel progressPanel;
    protected JCheckBox realtimeSimulationCheckBox;
    protected JButton startButton;
    // End of variables declaration

}
